DragManager (PIXI) Class
Drag manager is responsible for handling the dragging of stage elements supports click-n-stick and click-n-drag functionality.
Constructor
Item Index
Methods
Properties
Methods
_handlePointSnap
-
localMousePos
Handles snapping the dragged object to the nearest among a list of points
Parameters:
-
localMousePos
createjs.PointThe mouse position in the same space as the dragged object.
_objMouseDown
-
type
-
object
Mouse down on an obmect
Parameters:
-
type
IntThe type of input that triggered this call - either TYPE_MOUSE or TYPE_TOUCH.
-
object
PIXI.DisplayObjectThe object that should be dragged.
_startDrag
()
private
Internal start dragging on the stage
_stopDrag
-
ev
-
doCallback
Internal stop dragging on the stage
Parameters:
-
ev
EventMouse up event
-
doCallback
BoolIf we should do the callback
_triggerHeldDrag
-
interactionData
Start hold dragging
Parameters:
-
interactionData
PIXI.InteractionDataThe ineraction data about the moved mouse
_triggerStickyClick
()
private
Start the sticky click
_updateObjPosition
-
interactionData
Update the object position based on the mouse
Parameters:
-
interactionData
PIXI.InteractionDataMouse move event
addObject
-
obj
-
bound
Adds properties and functions to the object - use enableDrag() and disableDrag() on objects to enable/disable them (they start out disabled). Properties added to objects: _dragBounds (Rectangle), _onMouseDownListener (Function), _dragMan (cloudkid.DragManager) reference to the DragManager these will override any existing properties of the same name
Parameters:
-
obj
PIXI.DisplayObjectThe display object
-
bound
PIXI.RectangleThe rectangle bounds
destroy
()
public
Destroy the manager
initialize
-
startCallback
-
endCallback
Constructor
removeObject
-
obj
Removes properties and functions added by addObject().
Parameters:
-
obj
PIXI.DisplayObjectThe display object
startDrag
-
object
-
interactionData
Manually starts dragging an object. If a mouse down event is not supplied as the second argument, it defaults to a held drag, that ends as soon as the mouse is released.
Parameters:
-
object
PIXI.DisplayObjectThe object that should be dragged.
-
interactionData
PIXI.InteractionDataThe interaction data about the input event that triggered this.
stopDrag
-
doCallback
Stops dragging the currently dragged object.
Parameters:
-
doCallback
BoolIf the drag end callback should be called. Default is false.
Properties
_dragOffset
PIXI.Point
private
The local to global position of the drag
_theStage
PIXI.Stage
private
Reference to the stage
allowStickyClick
Bool
public
If sticky click dragging is allowed.
Default: true
draggedObj
PIXI.DisplayObject
public
The object that's being dragged
dragStartThreshold
Unknown
public
The radius in pixel to allow for dragging, or else does sticky click
Default: 20
isHeldDrag
Bool
public
Is the drag being held on mouse down (not sticky clicking)
Default: false
isStickyClick
Bool
public
Is the drag a sticky clicking (click on a item, then mouse the mouse)
Default: false
isTouchMove
Bool
public
Is the move touch based
Default: false
mouseDownObjPos
PIXI.Point
private
The position x, y of the object when interaction with it started.
mouseDownStagePos
PIXI.Point
private
The position x, y of the mouse down on the stage
snapSettings
Object
public
Settings for snapping.
Format for snapping to a list of points: { mode:"points", dist:20,//snap when within 20 pixels/units points:[ { x: 20, y:30 }, { x: 50, y:10 } ] }
Default: null